{extend name="admin@index_layout"/}
{block name="main"}
<div class="layui-card">
    <div class="layui-card-header">订单列表</div>
    <div class="layui-card-body">
        <table class="layui-hide" id="currentTable" lay-filter="currentTable"></table>
    </div>
</div>
{/block}
{block name="script"}
<script>
layui.use('yznTable', function() {
    var yznTable = layui.yznTable;

    var init = {
        table_elem: '#currentTable',
        table_render_id: 'currentTable',
        delete_url: "{:url('del')}",
    };

    yznTable.render({
            init: init,
            toolbar: ['refresh'],
        url: '{:url("index")}',
        cols: [
            [
                { field: 'id', width: 60, title: 'ID' },
                { field: 'trade_sn',width: 250,align: "left", title: '订单ID' },
                { field: 'title', title: '标题' },
                { field: 'user_id', width: 80,title: '会员id' },
                { field: 'catid', width: 80,title: '栏目id' },
                { field: 'contentid', width: 80,title: '内容id' },
                { field: 'pay_price', width: 120, title: '支付金额', templet: '<div>{{ d.pay_price }} {{#  if(d.type==1){ }} 元 {{#  } else { }} 点 {{#  } }}</div>' },
                { field: 'pay_type', width: 100, title: '支付类型'},
                { field: 'pay_time', width: 180, title: '支付时间',search: 'range',templet: yznTable.formatter.datetime },
                { field: 'create_time', width: 180, title: '创建时间' , search: 'range'},
                { field: 'status', width: 90, title: '订单状态',templet: yznTable.formatter.label,selectList:{'succ':'成功','failed':'失败','error':'异常','cancel':'取消','unpay':'待支付'},custom:{'succ':"green",'failed':"red",'error':"orange",'unpay':"red"}},
                { width:60, title: '操作',templet: yznTable.formatter.tool,operat: ['delete']}
            ]
        ],
        page: {}
    });
});
</script>
{/block}